<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text">
<p></p>
</body>
<script>
    const input = document.querySelector("input");
	const p = document.querySelector("p");
    const data = {
		str:"我现在正在学习vue"
    };
	const $data = {
		str:data.str
    };
	Object.defineProperty(data,"str",{
		get(){
		    return $data.str;
        },
		set(v){
			$data.str = input.value = p.innerText = v;
        }
    })
	input.value = p.innerText = data.str;
	input.oninput = function(){
		data.str = this.value.trim();
    }

</script>
</html>